import { ref } from 'vue';
export const useProductFormData = () => {
    const form: any = ref({
        id: null, //需求id
        requireName: '', //需求标题
        requireNumber: '', //编号
        relateRequireId: null, //关联业务需求id
        relateRequireName: null,
        relateVersionId: null, //版本id
        relateVersionName: null,
        relateVersionNumber: null,
        repairVersion: '', // 修复版本
        requireType: null, //需求类型
        requireSystem: null, //所属系统
        expectTime: '', //期望完成时间
        requireDesc: '', //需求描述
        level: '4', //等级
        onlineTime: '', //上线时间
        agentUser: '',
        agentUserEmpId: '',
        reason: '', // 理由
        checkStandard: '', // 标准
        files: [], // 文件
        pmpLabels: [], //标签
        devType: '1', //系统类型
        calModel: '0',
        storyPoints: 0, //sp
        planWorkHours: 0, //预估工时
        baseWorkHours: 0,
        workHourCount: 0,
        unitPrice: 0, //人天价格
        manDay: 0, //人天数
        planCost: 0, //预估成本
        systemType: '1',
        supplierName: '', //供应商名称
        supplierNum: '', //供应商号码
        supplierStatus: '', //供应商状态
        catalogCode: '',
        backPlanWorkHours: 0, //后端预估工时
        frontPlanWorkHours: 0, //前端预估工时
        executePlanWorkHours: 0//实施预估工时
    });
    const setForm = (subForm: any) => {
        Object.keys(subForm).forEach((key) => {
            form.value[key] = subForm[key];
        });
    };
    const resetForm = () => {
        setForm({
            id: null,
            requireName: '', //需求标题
            requireNumber: '', // 编号
            relateRequireId: null, //关联业务需求id
            relateRequireName: null,
            relateVersionId: null, //版本id
            relateVersionName: null,
            relateVersionNumber: null,
            requireType: null, //需求类型
            requireSystem: null, //所属系统
            expectTime: '', //期望完成时间
            requireDesc: '', //需求描述
            level: '4', //等级
            onlineTime: '', //上线时间
            agentUser: '',
            agentUserEmpId: '',
            reason: '', // 理由
            checkStandard: '', // 标准
            files: [], // 文件
            pmpLabels: [], //标签
            devType: '1', //系统类型
            calModel: '0', //计算方式
            storyPoints: 0, //sp
            planWorkHours: 0, //预估工时
            baseWorkHours: 0,
            workHourCount: 0,
            unitPrice: 0, //人天价格
            manDay: 0, //人天数
            planCost: 0, //预估成本
            systemType: '1',
            supplierName: '', //供应商名称
            supplierNum: '', //供应商号码
            supplierStatus: '', //供应商状态
            catalogCode: '',
            backPlanWorkHours: 0, //后端预估工时
            frontPlanWorkHours: 0, //前端预估工时
            executePlanWorkHours: 0//实施预估工时
        });
    };
    return {
        form,
        setForm,
        resetForm
    };
};